home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dbase
/
lib19.zip
/
MISC.PRG
< prev
next >
Wrap
Text File
|
1992-09-09
|
37KB
|
995 lines
*-------------------------------------------------------------------------------
*-- Program...: MISC.PRG
*-- Programmer: Ken Mayer (KENMAYER)
*-- Date......: 06/25/1992
*-- Notes.....: These are the miscellaneous functions/procedures from the PROC
*-- file that aren't as commonly used as the others. See README.TXT
*-- for details on how to use this library file.
*-- The following functions have been copied from the appropriate
*-- library files, and may be deleted if this program is simply
*-- copied into the PROC.PRG file with STRINGS.PRG and CONVERT.PRG
*-- files:
*-- ATCOUNT() (from STRINGS.PRG)
*-- DEC2HEX() (from CONVERT.PRG)
*-- STRPBRK() (from STRINGS.PRG)
*-------------------------------------------------------------------------------
FUNCTION PlayIt
*-------------------------------------------------------------------------------
*-- Programmer..: Mike Carlisle (A-T)
*-- Date........: 01/21/1992
*-- Notes.......: This function (from Technotes, issue??) will play a song
*-- stored in a memory variable (array).
*-- This is a two dimensional array, with the first dimension
*-- defined being the # of notes, each note having two parts.
*-- For a song with 12 notes, the declare statement is:
*-- DECLARE aSong[12,2]
*-- aSong[1,1] is the pitch of the first note.
*-- aSong[1,2] is the duration of the first note.
*-- Pitches are defined from C below Middle C to B below Middle C.
*-- These are from a "tempered" scale. Values can be raised an
*-- octave by doubling the number, lowered by halving it.
*-- Duration can be from 1 to 20.
*-- Note Value
*-- C 261
*-- C# 277
*-- D 294
*-- D# 311
*-- E 329
*-- F 349
*-- F# 370
*-- G 392
*-- G# 415
*-- A 440
*-- A# 466
*-- B 494
*-- Written for.: dBASE IV, 1.1
*-- Rev. History: 01/21/1992 - Modified to allow use of parameter to choose
*-- the song to be played. This alleviates the need for the
*-- procedures SONG1 and SONG2 and the memfile created by them.
*-- Two songs are provided (see below) ...
*-- Calls.......: None
*-- Called by...: Any
*-- Usage.......: PlayIt(<nSong>)
*-- Example.....: @5,10 say "Enter last name: " get lName valid required
*-- .not. empty(lName);
*-- error PlayIt(1)+"There must be a lastname ..."
*-- Read
*-- && OR
*-- ?? PlayIt(2)
*-- Returns.....: Nul (or Beep on invalid parameter)
*-- Parameters..: nSong = Song number. Programmer might consider adding to the
*-- list below for any songs added for documentation
*-- purposes ...
*-- VALID VALUES/SONGS:
*-- 1 = Dirge
*-- 2 = "Touchdown"
*-------------------------------------------------------------------------------
parameter nSong
private aSong, nCounter
*-- check for valid type of parameter ... must be numeric ...
if .not. type("nSong") $ "NF"
return chr(7)
endif
*-- get the integer value of nSong ... in case someone tries a "fast one"
nSong = int(nSong)
*-- load song
do case
case nSong = 1 && dirge
declare aSong[12,2] && 12 notes, 2 parts each
store 220 to aSong[1,1] && pitch
store 10 to aSong[1,2] && duration
store 220 to aSong[2,1]
store 10 to aSong[2,2]
store 220 to aSong[3,1]
store 2 to aSong[3,2]
store 220 to aSong[4,1]
store 10 to aSong[4,2]
store 261.63 to aSong[5,1]
store 7 to aSong[5,2]
store 246.94 to aSong[6,1]
store 2 to aSong[6,2]
store 246.94 to aSong[7,1]
store 5 to aSong[7,2]
store 220 to aSong[8,1]
store 5 to aSong[8,2]
store 220 to aSong[9,1]
store 5 to aSong[9,2]
store 205 to aSong[10,1]
store 5 to aSong[10,2]
store 220 to aSong[11,1]
store 15 to aSong[11,2]
case nSong = 2 && "touchdown"
declare aSong[7,2] && 7 notes, 2 parts each
store 523.5 to aSong[1,1] && pitch
store 2 to aSong[1,2] && duration
store 587.33 to aSong[2,1]
store 2 to aSong[2,2]
store 659.29 to aSong[3,1]
store 2 to aSong[3,2]
store 783.99 to aSong[4,1]
store 7 to aSong[4,2]
store 659.29 to aSong[5,1]
store 2 to aSong[5,2]
store 783.99 to aSong[6,1]
store 10 to aSong[6,2]
otherwise && not song 1 or 2, return nothing
return chr(7)
endcase
*-- playback
nCounter = 1
do while type("aSong[nCounter,1]") = "N"
set bell to aSong[nCounter,1],aSong[nCounter,2]
?? chr(7) at col()
nCounter = nCounter + 1
enddo
set bell to && return value to original
RETURN ""
*-- EoF: PlayIt()
PROCEDURE PageEst
*-------------------------------------------------------------------------------
*-- Programmer..: Rachel Holmen (RAEHOLMEN)
*-- Date........: 02/04/1992
*-- Notes.......: This procedure estimates the number of pages needed for an
*-- output list.
*-- Written for.: dBASE IV, 1.1
*-- Rev. History: 01/15/1992 - original procedure.
*-- 02/04/1992 - Ken Mayer - overhaul to allow the sending of
*-- parameters for fields, rather than hard coding. Attempted to
*-- make this a "black box" procedure.
*-- Calls.......: CENTER Procedure in PROC.PRG
*-- SHADOW Procedure in PROC.PRG
*-- Called by...: Any
*-- Usage.......: Do PageEst with <nCount>,"<cReport>",<nRecords>
*-- Example.....: Use printers
*-- Do PageEst with 0,"Printer for 'Hew' $ Brand",55
*-- Returns.....: None
*-- Parameters..: nCount = record count for records to be printed ...
*-- if sent as "0", system will do a RECCOUNT() for you
*-- cReport = name of report, with any filters ... (FOR ...)
*-- nRecords = number of records per page the report will handle.
*-- if sent as "0", system will assume 60 ...
*-------------------------------------------------------------------------------
parameters nCount,cReport,nRecords
private cReport2,nPos,nPage,cPage,cChoice,cCursor
cReport2 = upper(cReport)
*-- make sure we have a number of records to work with ...
if nCount = 0
if at("FOR",cReport2) > 0 && if a filter, extract the filter
npos = at("FOR",cReport2) && so we can count records that match
cFilter = substr(cReport,Pos+3,len(cReport)-(npos-1))
count to nCount for &cFilter
else
nCount = reccount()
endif
endif
if nRecords = 0
nRecords = 60
endif
*-- calculate the number of pages for the report ...
store int(nCount/nRecords) to nPage
if mod(nCount,nRecords) > 45
store nPage+1 to nPage
else
store (nCount/nRecords) to nPage
endif
if nCount>0 .and. nCount < nRecords
store 1 to nPage
endif
*-- deal with displaying info, and printing the report ...
save screen to sPrinter
activate screen && in case there are other windows on screen ...
define window wPrinter from 8,15 to 15,65 double color rg+/gb,w/n,rg+/gb
do shadow with 8,15,15,65
activate window wPrinter
*-- figure out how much to tell the user ...
if mod(nCount,nRecords) > 19 .and. mod(nCount,nRecords) < 46
store ltrim(str(nPage))+" and a half pages.)" to cPage
else